package com.java.al.file;

import java.io.File;

public class GetDirFileNames {
	
	public static void getFiles(String dirPath,String linkPath){
		File dir = new File(dirPath);
		if(dir.isDirectory()){
			String[] names = dir.list();
			int i = 0;
			for (String name : names) {
				File file = new File(dirPath+"/"+name);
				String fileName = file.getName();
//				System.out.println(fileName+"-="+fileName.indexOf("."));
				if(fileName.indexOf(".")!=-1){
//					System.out.println(fileName.substring(fileName.indexOf(".")));
					if(fileName.substring(fileName.indexOf(".")).equals(".swf")){
						
						System.out.println("http://www.fusioncharts.com/demos/"+linkPath+"/"+fileName);
						i++;
					}
				}
			}
			System.out.println( i );
		}else{
			System.out.println("给个文件夹路径，别拿文件糊弄我！");
		}
	}
	
//	public static void makeLink(String fileName){
//		System.out.println("http://www.fusioncharts.com/demos/gallery/Charts/"+fileName);
//	}
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
//		GetDirFileNames.getFiles("E:/My/FusionCharts样例展示/Charts","gallery/Charts");
		GetDirFileNames.getFiles("E:/My/workspace/Study/ForJar/swf/com/fc","gallery/Charts/");
//		GetDirFileNames.getFiles("E:/My/FusionChartsSuiteEval/FusionCharts XT/Charts","gallery/Charts/");
//		GetDirFileNames.getFiles("E:/My/FusionChartsSuiteEval/FusionWidgets XT/Charts","gallery/charts/widgets/");
//		GetDirFileNames.getFiles("E:/My/FusionChartsSuiteEval/PowerCharts/Charts","gallery/charts/powercharts/");
//		GetDirFileNames.getFiles("E:/My/FusionChartsSuiteEval/FusionMaps/Maps","gallery/maps/MapSWF");

	}

}
